<!-- 我的病情 -->

<template>
	<view class="container">
		<!-- 每日用药 -->
		<view class="table" >
			<view class="thead">
				<view class="w25">每日用药</view>
				<view class="modify"  @click="toPath('/pages/prescription/index')"> <text class="icon icon-edit"></text>编辑 <text class="icon arrow"></text></view>
			</view>
			<view class="tbody" >
				<view class="th">
					<view class="label"><image class="editImg" src="../../static/images/ill01.jpg" mode=""></image>服药时间</view>
					<view class="content"><image class="editImg" src="../../static/images/ill02.jpg" mode=""></image>药品</view>
				</view>
				<view class="td">
					<view class="trs">
						<view class="tr" v-for="(item,index) in prescription" :key="index">
							<view class="label">{{item.time}}</view>
							<view class="content"><text v-for="(it,ind) in item.med" :key="ind">{{it.med_name}}{{it.spec}}{{it.dosage}}；</text></view>
						</view>
					</view>
				</view>
			</view>
		</view>
		
		<!-- 我的症状； -->
		<view class="table" >
			<view class="thead">
				<view class="w25">我的主诉</view>
				<view class="modify"  @click="toPath('/pages/symptom/index')"> <text class="icon icon-edit"></text>编辑 <text class="icon arrow"></text></view>
			</view>
			<view class="tbody" >
				<view class="th">
					<view class="label"><image class="editImg" src="../../static/images/ill03.jpg" mode=""></image> 主诉</view>
					<view class="content"><image class="editImg" src="../../static/images/ill04.jpg" mode=""></image>病情</view>
				</view>
				<view class="td">
					<view class="trs">
						<view class="tr" v-for="(item,index) in symptom" :key="index">
							<view class="label">{{item.name}}</view>
							<view class="content">{{item.where}}{{item.sname}}{{item.name}}</view>
						</view>
					</view>
				</view>
			</view>
		</view>		
		<tabber :selected='1'></tabber>
	</view>
</template>

<script>
	import tabber from '../../components/tabber/index.vue'
	
	export default {
		name: "",
		data() {
			return {
				prescription:[], //每日用药
				symptom:[]  //我的症状
			}
		},
		props: {

		},
		components: {
			tabber
		},
		onLoad() {

		},
		onShow() {
			this.getUserDetail()
		},
		methods: {
			/**
			 * 请求用户信息
			 */
			getUserDetail(){
				let _this = this;
				 _this.$utils.request({
					 url:"/patient/user_info/",
				 }).then(res=>{
					 _this.prescription = res.data.prescription;
					 res.data.symptom.forEach(item => {
							_this.$switch.sid(item);
							_this.$switch.severity(item)
					 })
					 _this.symptom = res.data.symptom;
				 })
			},
			// 页面跳转
			toPath(e){
				this.$routeJump.navigateTo(e);
			}
		},
		onShareAppMessage() {}
	}
</script>

<style lang="scss" scoped>
	.container{
		padding: 30rpx 30rpx 150rpx;
		.table {
			margin-bottom: 30rpx;
			.thead {
				width: 100%;
				height: 94rpx;
				@include flex(space-between, center);
				position: relative;
				font-weight: bold;
				.modify {
					font-size: 28rpx;
					font-weight: normal;
					color: #666;
					@include absolute(50%, 20rpx, 0, -50%, top, right)
				}
			}
			.tbody{
				border: 1rpx solid #f1f1f1;
				border-radius: 14rpx;
				box-shadow: 0rpx 2rpx  4rpx 4rpx #eee;
				.th{
					height: 86rpx;
					padding: 0 20rpx;
					font-size: 32rpx;
					border: 1rpx solid #f1f1f1;
					background-color: #f8f8f8;
					@include flex(space-between,center);
					text-align: center;
				}
				.td{
					width: 100%;
					padding: 0 20rpx;
					.trs{
						max-height: 320rpx;
						overflow-y: auto;
						font-size: 30rpx;
						.tr{
							border-top: 1rpx solid #f1f1f1;
							border-bottom: 1rpx solid #f1f1f1;
							@include flex(space-between,center)
							.content{
								padding:14rpx 0 14rpx 10rpx;
								border-left: 1rpx solid #f1f1f1;
								width: 65%;
							}
							&:first-child{
								border-top:0;
							}
						}
					}
				}
				.label{
					width: 35%;
					text-align: center;
				}
				.content{
					width: 65%;
				}
			}
		}
	}
	
</style>
